Estoy usando expo-calendar y recuperando un objeto de calendarios del dispositivo de un usuario.
Después de recibir los calendarios, estoy usando el calendario para recuperar los eventos de los calendarios individuales.
Al solicitar los eventos, recibo {"_U":0,"_V":0,"_W":null,"_X":null} cuando registro los datos del evento solicitado.
Junto con esto, recibo el error: [Unhandled promise rejection: Error: An exception was thrown while calling `ExpoCalendar.getEventsAsync` with arguments `(] at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name at http://127.0.0.1:19000/index.bundle?platform=ios&dev=true&hot=false&minify=false:321320:82 in getEventsAsync$ at Screens/Tasks_1.js:1018:15 in <global>
Creo que esto se debe a que la solicitud const events = Calendar.getEventsAsync() está esperando una promesa, pero no puedo determinar qué respuesta está esperando. ¿Cómo puedo acceder correctamente a los eventos?
useEffect(() => { (async () => { //REQUEST PERMISSION TO ACCESS CALENDAR const { status } = await Calendar.requestCalendarPermissionsAsync(); if (status === "granted") { const calendars = await Calendar.getCalendarsAsync( Calendar.EntityTypes.EVENT ); //LIST OF ALL CALENDARS ON DEVICE WITH ID's console.log("Here are all your calendars:"); console.log({ calendars }); //GET EVENTS FROM A CALENDAR ON DEVICE WITH A GIVEN ID AND TIME RANGE const events = Calendar.getEventsAsync( calIDs, "2021-04-14T17:00:00.00Z", "2021-09-14T17:00:00.00Z" ); //THIS LOGS {"_U":0,"_V":0,"_W":null,"_X":null} console.log("EVENTS" + JSON.stringify(events)); } })(); }, []);{"_U":0,"_V":0,"_W":null,"_X":null} ¡Esto probablemente sucede porque no agregó la palabra clave await antes de Calendar.getEventsAsync !